package article2.builder;

import java.util.Objects;

/**
 * 经典纽约风味的比萨
 * 可以定义尺寸参数
 * @author cctv
 */
public class NyPizza  extends Pizza{
    public enum Size {SMALL,MEDIUM,LARGE}
    private final Size size;
    public static class Builder extends Pizza.Builder<Builder>{
        private final Size size;

        public Builder(Size size){
            this.size = Objects.requireNonNull(size);
        }

        @Override
        public NyPizza build(){
            return new NyPizza(this);
        }

        @Override
        protected  Builder self(){
            return this;
        }
    }

    /**
     * 私有构造器
     * @param builder
     */
    private NyPizza(Builder builder){
        super(builder);
        size = builder.size;
    }
}
